﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using xxx.Candidates.System.Interfaces.IService;
using xxx.Candidates.System.Model.Entity;

namespace xxx.Candidates.System.Interfaces.Service
{
    public class SysUsersService : BaseService<Sys_Users>, ISysUsersService
    {

        public SysUsersService(IUnitOfWork unitOfWork) : base(unitOfWork)
        {
        }

        /// <summary>
        /// 获取用户权限标识
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public List<string> GetUserPowers(string userId)
        {
            // 超级管理员拥有所有权限
            if (userId == "admin")
            {
                return Db.Queryable<Sys_Power>().Select(m => m.Name).ToList();
            }

            return new List<string>();
        }
    }
}
